package com.gxa.service.impl;

import com.gxa.dao.AlarmMapper;
import com.gxa.pojo.Alarm;
import com.gxa.pojo.AlarmVO;
import com.gxa.service.AlarmService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;
import java.util.List;
@Service("AlarmService")
public class AlarmServiceImpl implements AlarmService {
    @Resource
    private AlarmMapper alarmMapper;

    @Override
    public List<Alarm> showAlarm(AlarmVO alarmVO) {
        List<Alarm> alarms= alarmMapper.showAlarm(alarmVO);
        return alarms;
    }

    @Override
    public int getCount() {
        return alarmMapper.getCount();
    }

    @Override
    public List<Alarm> selectByCondition(AlarmVO alarmVO) {
        List<Alarm> alarms=alarmMapper.selectByCondition(alarmVO);
        return alarms;
    }

    @Override
    public Boolean addAlarm(Alarm alarm) {
        int row=alarmMapper.addAlarm(alarm);
        if(row>0){
            return true;
        }else {
            return false;
        }

    }

    @Override
    public Boolean deleteByAlarmRulesName(String alarmRulesName) {
        int row=alarmMapper.deleteByAlarmRulesName(alarmRulesName);
        if(row>0){
            return true;
        }else {
            return false;
        }
    }
}
